﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <meta name="viewport" content="width=device-width" />
    <title>FlashAdManage</title>



</head>
<body>
    <table id="dg" class="easyui-datagrid" style="width: auto; height: auto"
        data-options="rownumbers:true,singleSelect:true,pagination:true,url:'../admin/Readpiclist',toolbar:'#toolb'">
        <thead>
            <tr>
                <th data-options="field:'imgurl',width:200">图片路径</th>
                <th data-options="field:'is_enable',width:80,align:'right'">是否可见</th>
                <th data-options="field:'alt',width:80,align:'right'">鼠标覆盖时提示</th>
            </tr>
        </thead>
    </table>
    <div id="toolb" style="padding: 2px 5px;">

        <div id="ft" style="padding: 2px 5px;">
            <a href="#" class="easyui-linkbutton" iconcls="icon-add" onclick="add()" plain="true">添加</a>
            <a href="#" class="easyui-linkbutton" iconcls="icon-remove" onclick="del()" plain="true">删除</a>
        </div>
        <div>提示： 本Flash广告最大只能有4张图可见（用户自己保证）</div>
    </div>


    <div id="dlgadd" class="easyui-dialog" title="添加一个Flash展示图片" style="width: 600px; height: 400px;"
        data-options="iconCls:'icon-add',resizable:true,modal:true,closed: true">
        <%using (Html.BeginForm("addImg", "admin", FormMethod.Post, new { enctype = "multipart/form-data" }))%>
        <%{%>
        <table cellspacing="0" cellpadding="0" border="0" style="width: 77%">
            <tr>
                <td height="25" width="30%" align="right">图片
	：</td>
                <td height="25"  align="left">
                    <input id="file" name="file" type="file" accept=".png,.jpg,.gif,.bmp" />
                    
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">是否可见
	：</td>
                <td height="25" width="*" align="left">
                   
                    <%=Html.CheckBox("checkbox") %> 选中可见
                </td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right">鼠标覆盖时提示
	：</td>
                <td height="25" width="*" align="left">
                   <%=Html.TextBox("txtalt") %></td>
            </tr>
            <tr>
                <td height="25" width="30%" align="right"></td>
                <td height="25" width="*" align="left">
                   
                    <input type="submit" value="添加" />
                </td>

            </tr>
        </table>
        <%} %>
    </div>


    <script type="text/javascript">

        function add() {
            $('#dlgadd').dialog({
                title: '添加',
                width: 450,
                height: 200,
                closed: false,
                cache: false,
                modal: true
            });
        }
      

        function del() {

            var row = $('#dg').datagrid('getSelected');
            if (row.length == 0) {
                $.messager.alert('提示', '请选择要删除的图片');
            } else if (row.length > 1) {
                $.messager.alert('提示', '一次只能删除一张图');
            } else {
                $.post("../admin/DelImg", { ID: row.ID },
               function (data) {
                   if (data == false) {
                       $.messager.alert('未知错误', '删除失败.');
                   }
                   else {
                       $.messager.alert('提示', '删除成功');
                       $('#dg').datagrid('load', {
                           code: '01',
                           name: 'name'
                       });
                   }
               });
            }
        }
    </script>

</body>
</html>
